package day014.homework.p6;

import java.util.HashSet;
import java.util.Iterator;

public class Test {
    public static void main(String[] args) {
        HashSet<String> set = new HashSet<>();
        set.add("刘备");
        set.add("关羽");
        set.add("张飞");
        set.add("刘备");
        set.add("张飞");

        System.out.println(set.size());

        Iterator<String> iter = set.iterator();
        while (iter.hasNext()) {
            System.out.print(iter.next());
            System.out.print(" ");
        }
        System.out.println();

        for (String s : set) {
            System.out.print(s + " ");
        }
    }
}
